package com.example.demo.test1.entity;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.Serializable;

/**
 * 增加短信验证码认证
 *
 * 2020.05.06修改：不再继承UsernamePasswordCredential，而是直接实现Credential
 *
 * @author g12575
 * @date 2019/10/14 16:39
 * @since v1.0.1
 */
@SuppressWarnings("AlibabaLowerCamelCaseVariableNaming")
public class UsernamePasswordSmsCredential implements Serializable {

    public static final String AUTHENTICATION_ATTRIBUTE_PASSWORD = "credential";
    private static final long serialVersionUID = -700605081472810939L;

    private String username;
    private String password;

    private String phoneNumber;
    private String openSmsCheck;
    private String openCaptchaCheck;
    private String message;

    private String hospitalId;
    private String number;

    private String verCode;
    private String verCodeUUID;

    public UsernamePasswordSmsCredential() {
    }

    public UsernamePasswordSmsCredential(String username, String password) {
        this.username = username;
        this.password = password;
    }


    public UsernamePasswordSmsCredential(final String userName, final String password, final String phoneNumber, final String openSmsCheck,
                                         final String message) {
        this.username = userName;
        this.password = password;
        this.phoneNumber = phoneNumber;
        this.openSmsCheck = openSmsCheck;
        this.message = message;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(final String password) {
        this.password = password;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(final String userName) {
        this.username = userName;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getOpenSmsCheck() {
        return openSmsCheck;
    }

    public void setOpenSmsCheck(String openSmsCheck) {
        this.openSmsCheck = openSmsCheck;
    }

    public String getOpenCaptchaCheck() {
        return openCaptchaCheck;
    }

    public void setOpenCaptchaCheck(String openCaptchaCheck) {
        this.openCaptchaCheck = openCaptchaCheck;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(String hospitalId) {
        this.hospitalId = hospitalId;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getVerCode() {
        return verCode;
    }

    public void setVerCode(String verCode) {
        this.verCode = verCode;
    }

    public String getVerCodeUUID() {
        return verCodeUUID;
    }

    public void setVerCodeUUID(String verCodeUUID) {
        this.verCodeUUID = verCodeUUID;
    }


    @Override
    public String toString() {
        return this.username;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final UsernamePasswordSmsCredential that = (UsernamePasswordSmsCredential) o;

        if (this.password != null ? !this.password.equals(that.password) : that.password != null) {
            return false;
        }

        return this.username != null ? this.username.equals(that.username) : that.username == null;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
            .append(this.username)
            .append(this.password)
            .toHashCode();
    }

}
